import action.ActionHelper;
import action.DoAction;
import http.core.Bootstrap;
import service.MyMsgArrive;

import java.util.Scanner;

/**
 * Created by zhangting on 02/04/2019.
 */
public class Main {
    public static void main(String[] args) {

        System.out.println("/yxapi/getBody \t /yxapi/seed");

       new Thread(()->{
           DoAction.setMsgArrive(new MyMsgArrive());
           Bootstrap.startHttpServer(8182);}).start();

        System.out.println("=========p");
          Scanner sc = new Scanner(System.in);
          while (true) {
            String line = sc.nextLine();
            if (line.equals("exit"))  {
                break;
            }else if(line.equalsIgnoreCase("register")){
                ActionHelper.getInstance().register("http://localhost:8033/spider/register");
            }else if(line.equalsIgnoreCase("sfriend")){
              String a=  ActionHelper.getInstance().sendFriendMsg("fromqq","toqq","this is msg to be send");
                System.out.println("=====send result: "+a);
            }else if(line.equalsIgnoreCase("getlist")){
                String a=  ActionHelper.getInstance().getFriendList("00000");
                System.out.println("=====send result: "+a);
            }
          }


    }
}
